<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<link rel="icon" href="/logo.ico" type="image/x-icon"/>
		<link href="/css/bootstrap.min.css" rel="stylesheet">
        <link href="/css/style.css" rel="stylesheet">
        <script src="/js/markdown-palettes.js"></script>
        <link href="/css/markdown-palettes.css" rel="stylesheet">
		<link href="/css/modern-business.css" rel="stylesheet">
		<script src="/js/axios.min.js"></script>
		<script src="/js/ace.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/edit.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
		<style>
			#editor
			{
				width:50%;
				height:100%;
				float:left;
				margin-bottom:25px;
			}
			#shower
			{
				width:50%;
				height:100%;
				float:left;
				overflow:auto;
			}
		</style>
	</head>
	<body>
        <iframe src="/head.html" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="height:75px;"></iframe><br>
        <iframe src="/main-control1.html" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" id="main-control1" style="height:40px;"></iframe><br>
		<div id="editor"></div>
		<script>
			var editor_type="markdown";
			var init_code="<init_code>";
			var show_init_code=decodeURIComponent(init_code);
			console.log(show_init_code)
			var editor=new MarkdownPalettes('#editor');
			console.log(editor);
			editor.content=show_init_code;
			window.onkeydown=function(key)
			{
				if(key.code=="KeyS"&&key.ctrlKey==true)
				{
					save(editor.content,"markdown");
					return false;
				}
			}
			function change_event()
			{
				/*var bottom_div=document.getElementById("main-control2").contentWindow.document.getElementById("bottom_div");
				var left_span=document.getElementById("main-control2").contentWindow.document.getElementById("left-span");
				bottom_div.style.background="red";
				left_span.innerHTML="已编辑，未保存";*/
				var status_text=document.getElementById("status-text");
				status_text.style.color="red";
				status_text.innerHTML="已编辑，未保存";
			}
			async function content_listener()
			{
				var origin=editor.content;
				setInterval(function(){if(editor.content!=origin){origin=editor.content;change_event();}},100);
			}
			content_listener();
			/*iframe=document.createElement("iframe");
			iframe.setAttribute("src","/main-control2.html");
			iframe.setAttribute("scrolling","no");
			iframe.setAttribute("border","0");
			iframe.setAttribute("frameborder","no");
			iframe.setAttribute("framespacing","0");
			iframe.setAttribute("allowfullscreen","true");
			iframe.setAttribute("id","main-control2");
			iframe.setAttribute("style","position:absolute;z-index:1000;right:0px;top:0px;height:40px;");
			document.getElementsByClassName("mp-editor-toolbar")[0].appendChild(iframe);*/
			status_text=document.createElement("a");
			status_text.setAttribute("id","status-text");
			status_text.setAttribute("style","position:absolute;z-index:1000;right:0px;top:7.5px;height:40px;color:#38b400;height:25px;");
			status_text.innerHTML="￥{LanguageCode:3002}￥";
			document.getElementsByClassName("mp-editor-toolbar")[0].appendChild(status_text);

		</script>
        <!--<iframe src="/main-control2.html" style="z-index:1000;position:fixed;bottom:0px;height: 25px;width:100%;" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" id="main-control2"></iframe>-->
        <script src="/js/bootstrap.bundle.min.js"></script>
	</body>
</html>